package ThaumPerditio.common.block;

import ThaumPerditio.common.ThaumPerditio;
import ThaumPerditio.common.lib.LibStrings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

import java.util.List;

public class BlockArcaneInfusedStone extends Block {

    @SideOnly(Side.CLIENT)
    private IIcon[] texture;

    final public static String[] subBlock = new String[]
            {
                    "blockStoneAer", "blockStoneTerra", "blockStoneIgnis", "blockStoneAqua", "blockStoneOrdo", "blockStonePerditio", "blockStoneMixed",
                    "blockBrickAer", "blockBrickTerra", "blockBrickIgnis", "blockBrickAqua", "blockBrickOrdo", "blockBrickPerditio", "blockBrickMixed"
            };
    public BlockArcaneInfusedStone ()
    {
        super(Material.rock);
        this.setResistance(10.0F);
        this.setHardness(2.0F);
        this.setStepSound(soundTypeStone);
        this.setCreativeTab(ThaumPerditio.tabThaumPerditio);
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister iconRegister){

        texture = new IIcon[subBlock.length];

        for(int i = 0; i<subBlock.length; i++) texture[i] = iconRegister.registerIcon(LibStrings.MODID + ":" + subBlock[i]);
    }

    @Override
    public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list ){
        for(int i = 0; i<subBlock.length; i++) {
            list.add(new ItemStack(block, 1, i));
        }
    }

    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int side, int metadata){
        return texture[metadata];
    }
}
